#ifndef WF_DRAWLINEPOLYGON2_H
#define WF_DRAWLINEPOLYGON2_H

#include "pf_previewactioninterface.h"
#include "gui_export.h"

/**
 * This action class can handle user events to draw polygons.
 *
 */
class GUI_EXPORT WF_DrawLinePolygon2 : public PF_PreviewActionInterface {
	Q_OBJECT
private:
    enum Status {
        SetCorner1,    /**< Setting center 1. */
		SetCorner2,    /**< Setting corner 2. */
		SetNumber      /**< Setting number in the command line. */
	};
	
public:
    WF_DrawLinePolygon2(PF_Container& container,
                              PF_GraphicView& graphicView);
    ~WF_DrawLinePolygon2() {}

	static QAction* createGUIAction(LX_Define::ActionType /*type*/, QObject* /*parent*/);
	
	virtual LX_Define::ActionType rtti() {
		return LX_Define::ActionDrawLinePolygon2;
	}

    virtual void trigger();
	
    virtual void mouseMoveEvent(PF_MouseEvent* e);
    virtual void mouseReleaseEvent(PF_MouseEvent* e);
    virtual void updateMouseButtonHints();
	
	virtual void coordinateEvent(PF_CoordinateEvent* e);
    virtual void commandEvent(PF_CommandEvent* e);
	virtual PF_StringList getAvailableCommands();
	
    virtual void hideOptions();
    virtual void showOptions();

    virtual void updateMouseCursor();
    virtual void updateToolBar();

	int getNumber() {
		return number;
	}

	void setNumber(int n) {
		number = n;
	}

private:
	/** 1st corner */
	PF_Vector corner1;
	/** 2nd corner */
	PF_Vector corner2;
	/** Number of edges. */
	int number;
	/** Last status before entering text. */
	Status lastStatus;
};

#endif
